<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>Insert title here</title>
	<link rel="stylesheet" href="__PUBLIC__/js/bootstrapvalidator/css/bootstrapValidator.min.css" />
	<link rel="stylesheet" href="__PUBLIC__/js/jquery-upload/css/jquery.fileupload.css" />
	<link rel="stylesheet" href="__PUBLIC__/js/jquery-upload/css/jquery.fileupload-ui.css" />
	<script type="text/javascript" src="__PUBLIC__/js/jquery-upload/js/vendor/jquery.ui.widget.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/jquery-upload/js/jquery.fileupload.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/jquery-upload/js/jquery.fileupload-ui.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/jquery-upload/js/jquery.iframe-transport.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/jquery-upload/js/jquery.fileupload-process.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/bootstrapvalidator/js/bootstrapValidator.min.js"></script>
</head>
<body>
<div class="modal-dialog" role="document" style="width:800px;">
	<div class="modal-content">
		<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
			<h4 class="modal-title" id="exampleModalLabel">空间详情</h4>
		</div>
		<form class="form-horizontal" style="padding:4%;height:500px;overflow-y:auto;" id="spaceForm">
			<input type="hidden" name="token" value="{$formToken}">
			<input type="hidden" name="id" value="{$id}"/>
			<div class="panel panel-default">
				<div class="panel-heading">
					<h3 class="panel-title">基本信息</h3>
				</div>
				<div class="panel-body">
					<div class="form-group">
						<label class="control-label col-sm-2">空间名称:</label>
						<div class="col-sm-4">
							<input type="text" class="form-control" name="name" value="{$space.name}" placeholder="请输入空间名称">
						</div>
						<label class="control-label col-sm-2">运营面积:</label>
						<div class="col-sm-4">
							<div class="input-group">
								<input type="text" class="form-control" name="area" value="{$space.area}" placeholder="请输入运营面积">
								<div class="input-group-addon">M&sup2;</div>
							</div>
						</div>
					</div>
					<div class="form-group">
						<label class="control-label col-sm-2">开放工位价格:</label>
						<div class="col-sm-4">
							<div class="input-group">
								<input type="text" class="form-control" name="station_open_price" value="{$space.station_open_price}" placeholder="请输入开放工位价格">
								<div class="input-group-addon">元</div>
							</div>
						</div>
						<label class="control-label col-sm-2">封闭工位价格:</label>
						<div class="col-sm-4">
							<div class="input-group">
								<input type="text" class="form-control" name="station_close_price" value="{$space.station_close_price}" placeholder="请输入封闭工位价格">
								<div class="input-group-addon">元</div>
							</div>
						</div>
					</div>
					<div class="form-group">
						<label class="control-label col-sm-2">空间地址:</label>
						<div class="col-sm-3">
							<select class="form-control" name="province" id="province">
								<foreach name="province" item="prov">
									<option value="{$prov.id}" <if condition="$space['province'] eq $prov['id']">selected</if>>{$prov.name}</option>
								</foreach>
							</select>
						</div>
						<div class="col-sm-3">
							<select class="form-control" name="city" id="city">

							</select>
						</div>
						<div class="col-sm-3">
							<select class="form-control" name="county" id="county">

							</select>
						</div>
					</div>
					<div class="form-group">
						<label class="control-label col-sm-2">详细地址:</label>
						<div class="col-sm-10">
							<input type="text" class="form-control" name="address" value="{$space.address}" placeholder="请输入空间详细地址">
						</div>
					</div>
					<div class="form-group">
						<label class="control-label col-sm-2">联系电话:</label>
						<div class="col-sm-4">
							<input type="text" class="form-control" name="phone" value="{$space.phone}" placeholder="请输入空间联系电话">
						</div>
					</div>
				</div>
			</div>

			<div class="panel panel-default">
				<div class="panel-heading">
					<h3 class="panel-title">财务信息</h3>
				</div>
				<div class="panel-body">
					<div class="form-group">
						<div class="col-sm-6">
							<p>含税收款账户</p>
						</div>
						<div class="col-sm-6">
							<p>不含税收款账户</p>
						</div>
					</div>
					<div class="form-group">
						<label class="control-label col-sm-2">账户名:</label>
						<div class="col-sm-4">
							<input type="text" class="form-control" name="account_name_tax" value="{$space.account_name_tax}" placeholder="请输入含税收款账户名">
						</div>
						<label class="control-label col-sm-2">账户名:</label>
						<div class="col-sm-4">
							<input type="text" class="form-control" name="account_name" value="{$space.account_name}" placeholder="请输入不含税收款账户名">
						</div>
					</div>
					<div class="form-group">
						<label class="control-label col-sm-2">账号:</label>
						<div class="col-sm-4">
							<input type="text" class="form-control" name="bank_card_id_tax" value="{$space.bank_card_id_tax}" placeholder="请输入含税收款账号">
						</div>
						<label class="control-label col-sm-2">账号:</label>
						<div class="col-sm-4">
							<input type="text" class="form-control" name="bank_card_id" value="{$space.bank_card_id}" placeholder="请输入不含税收款账号">
						</div>
					</div>
					<div class="form-group">
						<label class="control-label col-sm-2">开户行:</label>
						<div class="col-sm-4">
							<input type="text" class="form-control" name="bank_name_tax" value="{$space.bank_name_tax}" placeholder="请输入含税收款账户开户行">
						</div>
						<label class="control-label col-sm-2">开户行:</label>
						<div class="col-sm-4">
							<input type="text" class="form-control" name="bank_name" value="{$space.bank_name}" placeholder="请输入不含税收款账户开户行">
						</div>
					</div>
				</div>
			</div>
		</form>
		<div class="modal-footer">
			<button type="button" data-dismiss="modal" class="btn btn-default">取消</button>
		</div>
	</div>
</div>

<script type="text/javascript">
    var webRoot = "__ROOT__";
    var city = "{$space.city}";
    var county = "{$space.county}";
    $(function(){
        $("#province").bind("change",chooseProvince);
        $("#city").bind("change",chooseCity);
        $("#province,#city").change();
    });

    function chooseProvince() {
        var pid = $(this).val();
        $("#city,#county").empty();
        $.ajax({
            url: "{:U('Admin/Space/Spaces/getRegionByPid')}",
            type: "post",
            dataType: "json",
            data: {pid: pid},
            success: function (data) {
                var html = '';
                $.each(data,function (index,item) {
                    var selected = (city == item.id) ? " selected" : "";
                    html += '<option value="'+item.id+'"'+selected+'>'+item.name+'</option>';
                });
                $("#city").html(html).change();
            }
        });
    }

    function chooseCity() {
        var pid = $(this).val();
        $("#county").empty();
        $.ajax({
            url: "{:U('Admin/Space/Spaces/getRegionByPid')}",
            type: "post",
            dataType: "json",
            data: {pid: pid},
            success: function (data) {
                var html = '';
                $.each(data,function (index,item) {
                    var selected = (county == item.id) ? " selected" : "";
                    html += '<option value="'+item.id+'"'+selected+'>'+item.name+'</option>';
                });
                $("#county").html(html);
            }
        });
    }
</script>
</body>
</html>